Common commands for Bash (on Windows or WSL) include:
šļø **Navigation & Directory Management**
| Command | Description |
| --------------------- | ---------------------------------------------------- |
| `pwd` | Print the current working directory |
| `ls` | List files in the current directory |
| `ls -l` | List files in long format (permissions, owner, etc.) |
| `ls -a` | List all files including hidden files |
| `cd <directory>` | Change to a directory |
| `cd ..` | Go up one directory |
| `cd ~` | Go to the home directory |
| `mkdir <directory>` | Create a new directory |
| `mkdir -p dir/subdir` | Create nested directories |
š **File Creation & Viewing**
| Command | Description |
| ------------------ | ----------------------------------------------- |
| `touch <file>` | Create a new empty file |
| `start <filename>` | open a file w/ default editor (Windows not WSL) |
| `code <filename>` | open a file folder with VS Code (if enabled) |
| `code .` | open current folder with VS Code |
| `cat <file>` | Display the contents of a file |
| `less <file>` | Scroll through a file (q to quit) |
| `head <file>` | Show the first 10 lines |
| `tail <file>` | Show the last 10 lines |
| `nano <file>` | Open file in terminal text editor (basic) |
| `vim <file>` | Open file in Vim (more advanced editor) |
š§ **File and Folder Operations**
| Command | Description |
| -------------------------------------- | ----------------------------------- |
| `cp <source> <destination>` | Copy a file |
| `cp -r <source_dir> <destination_dir>` | Copy a directory recursively |
| `mv <source> <destination>` | Move or rename a file or folder |
| `rm <file>` | Delete a file |
| `rm -r <directory>` | Delete a directory and its contents |
| `rm -rf <directory>` | Force delete directory (dangerous!) |
š ļø **Permissions and Ownership**
| Command | Description |
| ----------------------------- | ------------------------------------------ |
| `chmod +x <file>` | Make a file executable |
| `chmod 755 <file>` | Set specific permissions |
| `chown <user>:<group> <file>` | Change file owner |
| `sudo` | Run command as superuser (e.g., `sudo rm`) |
š¦ **Other Useful Commands**
| Command | Description |
| -------------------------- | ---------------------------------------------------------------- |
| `file <filename>` | Show file type |
| `stat <file>` | Show detailed metadata |
| `find . -name "<pattern>"` | Find files matching a name |
| `du -sh <dir>` | Show disk usage of a directory |
| `df -h` | Show available disk space |
| `clear` | Clear screen |
| `source <script>` | Execute a [[Bash script]] |
| `which python` | print the version of Python in use |
| `where python` | print the location of all Python installations (Windows not WSL) |
> [!example]- Additional Resources
> - [101 Bash Commands and Tips for Beginners to Experts](https://dev.to/awwsmm/101-bash-commands-and-tips-for-beginners-to-experts-30je) for more common (and uncommon) bash commands.
> - [The GNU Bash Manual](https://www.gnu.org/software/bash/manual/bash.html)
> - [Bash Cheat Sheet](https://github.com/RehanSaeed/Bash-Cheat-Sheet)